package com.swsc.solarverse.model.biz;

import java.util.ArrayList;

/**
 * @Author CHENCL-X99
 * @Date 2025/5/14 16:56
 * @Version 1.0
 * @Description
 */
@lombok.Data
public class StringVoltageCurrentInvalidDataDTO {
    /**
     * 持续0电流 或小于1A
     */
    private java.util.List<String> zeroCurrentCodeIn;
    /**
     * 持续0电压
     */
    private java.util.List<String> zeroVoltageCodeIn;
    /**
     * 电流null值
     */
    private java.util.List<String> nullCurrentCodeIn;
    /**
     *
     */
    private java.util.List<String> nullVoltageCodeIn;
    /**
     * 电流连续相同值
     */
    private java.util.List<String> continuousCurrentCodeIn;
    /**
     * 电压连续相同值
     */
    private java.util.List<String> continuousVoltageCodeIn;


    private java.util.List<String> excludeStringCodeIn;


    public StringVoltageCurrentInvalidDataDTO() {
        int capacity = 16;
        this.zeroCurrentCodeIn = new ArrayList<>(capacity);
        this.zeroVoltageCodeIn = new ArrayList<>(capacity);
        this.nullCurrentCodeIn = new ArrayList<>(capacity);
        this.nullVoltageCodeIn = new ArrayList<>(capacity);
        this.continuousCurrentCodeIn = new ArrayList<>(capacity);
        this.continuousVoltageCodeIn = new ArrayList<>(capacity);
        this.excludeStringCodeIn = new ArrayList<>(capacity);
    }

    public void mergeExcludeStringCodeIn() {
        java.util.List<String> mergedList = mergeListsOrdered(this.zeroCurrentCodeIn, this.zeroVoltageCodeIn,
                this.nullCurrentCodeIn, this.nullVoltageCodeIn,
                this.continuousCurrentCodeIn);
        this.excludeStringCodeIn.addAll(mergedList);
    }

    public static <T> java.util.List<T> mergeListsOrdered(java.util.List<? extends T>... lists) {
        int totalSize = 0;
        for (java.util.List<? extends T> list : lists) {
            totalSize += list.size();
        }
        java.util.Set<T> mergedSet = new java.util.LinkedHashSet<>(totalSize);  // 预分配容量
        for (java.util.List<? extends T> list : lists) {
            mergedSet.addAll(list);
        }
        return new ArrayList<>(mergedSet);
    }
}
